package Day03.HomeWork;

import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class Demo4 {
    public static void main(String[] args) throws FileNotFoundException, UnsupportedEncodingException {
        FileOutputStream fos=new FileOutputStream("pw.txt");
		OutputStreamWriter osw = new OutputStreamWriter(fos, StandardCharsets.UTF_8);
		BufferedWriter bw = new BufferedWriter(osw);
		PrintWriter pw = new PrintWriter(bw,true);
        Scanner scn=new Scanner(System.in);
        System.out.println("请开始输入内容");
		while(true) {
			String str = scn.nextLine();
			if("exit".equals(str)) {
				break;
			}
			pw.println(str);
			pw.close();
		}
    }
}
